#include "stdio.h"
#include "stdlib.h"
#include "time.h"
void menu ()
{
printf ("******************************\n");    
printf ("**********  1.play  **********\n");    
printf ("**********  0.exit  **********\n");   
printf ("******************************\n");       
}
void game()
{
int ret = rand() % 100 + 1;
int h;
    printf ("请猜数\n"); 
while (1)
{
      scanf("%d",&h);
    if (ret > h)
      {
       printf ("猜小了");
       }
    else if (ret < h)
      {
       printf ("猜大了");
      }
    else
      {
       printf ("猜对了");
       break;
      }
}
}
int main ()
{
    int a;
 srand((unsigned int)time(NULL));
menu();
printf ("请输入:");
scanf ("%d",&a);
do
{
switch (a)
    {
      case 1:
          game();
          break;
      case 0:
           printf ("请退出");
           break;
    default:
           printf("输入错误，请重新输入:");
           break;
    }
}while (a);
return 0;
}